package com.qinker.oa.controller;

import com.qinker.oa.message.CodeMsg;
import com.qinker.oa.message.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
public class LogoutController {

    @RequestMapping("/oa/logout")
    @ResponseBody
    public Result<CodeMsg> logout(HttpSession session){
        session.removeAttribute("user");
        session.invalidate();
        return Result.successNoData(CodeMsg.SUCCESS);
    }
}
